#ifndef _VECTOR3
#define _VECTOR3

typedef struct
{
	float x,y,z;
} Vector3;

extern const Vector3 *vecZero;
extern const Vector3 *vecOne;

extern const Vector3 *vecUnitX;
extern const Vector3 *vecUnitY;
extern const Vector3 *vecUnitZ;

extern const Vector3 *vecUnitNegX;
extern const Vector3 *vecUnitNegY;
extern const Vector3 *vecUnitNegZ;

Vector3	Vector3Make		(float x,float y,float z);

void	vec3Ctor1		(Vector3 *ctorV,float x,float y,float z);
void	vec3Ctor2		(Vector3 *ctorV,const float *xyz);
void	vec3Ctor3		(Vector3 *ctorV,const Vector3 *v);

void	vec3Zero		(Vector3 *v);
void	vec3One			(Vector3 *v);
void	vec3UnitX		(Vector3 *v);
void	vec3UnitY		(Vector3 *v);
void	vec3UnitZ		(Vector3 *v);

float	vec3Component	(const Vector3 *v,char index);

void	vec3AddFloat	(const Vector3 *v,float value,Vector3 *result);
void	vec3SubFloat	(const Vector3 *v,float value,Vector3 *result);
void	vec3MulFloat	(const Vector3 *v,float value,Vector3 *result);
void	vec3DivFloat	(const Vector3 *v,float value,Vector3 *result);

void	vec3Add			(const Vector3 *v1,const Vector3 *v2,Vector3 *result);
void	vec3Sub			(const Vector3 *v1,const Vector3 *v2,Vector3 *result);
float	vec3Dot			(const Vector3 *v1,const Vector3 *v2);
void	vec3Cross		(const Vector3 *v1,const Vector3 *v2,Vector3 *result);
void	vec3Norm1		(Vector3 *v);
void	vec3Norm2		(const Vector3 *v,Vector3 *result);
float   vec3Len			(const Vector3 *v);
float   vec3LenSqr		(const Vector3 *v);
void	vec3Neg1		(Vector3 *v);
void	vec3Neg2		(const Vector3 *v,Vector3 *result);

#endif
